<?php

/**
 * @filename IndexAction.class.php 
 * @encoding UTF-8 
 * @author yuzhiyuan <307090870@qq.com>
 * @copyright copyright 2013 (c) Emagsoftware Technology Co., Ltd. All Rights reserved.
 * @license ……
 * @datetime 2013-6-22  12:42:10
 * @version 1.0
 * @Description
  */
class IndexAction extends BaseAction {
    public function index(){    	
        $list = S('post_index');
        if(false === $list){
            $db = M('Post');
            $list = $db->where('is_del = 0')->order('blg_post.sort asc,blg_post.add_time desc')->join('blg_user ON blg_post.u_id = blg_user.id')->join(' blg_cate ON blg_post.c_id = blg_cate.id')->limit(C('INDEX_POST_NUM'))->field("blg_post.id as aid,blg_post.title as atitle,blg_post.c_id as acid,blg_post.add_time as aaddtime,blg_user.nickname as bnickname,blg_cate.c_name as c_name,blg_post.content as acontent,blg_post.titlepic as atitlepic")->select();
            S('post_index', $list);
        }
        $this->assign('posts', $list);
        $this->display();
    }
}